package com.jinlia.show.modules.base.wxapp.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jinlia.show.modules.base.wxapp.entity.User;
import com.jinlia.show.modules.base.wxapp.mapper.UserMapper;
import com.jinlia.show.modules.base.model.query.UserQuery;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class UserMapperService extends ServiceImpl<UserMapper, User> {
    public Page<User> getPage(UserQuery queryParams) {
        // 构建分页参数
        int pageNum = queryParams.getCurrent();
        int pageSize = queryParams.getSize();
        Page<User> page = new Page<>(pageNum, pageSize);
        //构造查询参数
        LambdaQueryWrapper<User> lambdaQueryWrapper = new LambdaQueryWrapper();
        Page<User> pageSysUser = this.page(page, lambdaQueryWrapper);
        return pageSysUser;
    }
}
